import Vue from 'vue'
import App from './App.vue'
import router from './routers'
import axios from 'axios'
import treeTable from 'vue-table-with-tree-grid'

// import './plugins/element'
// import 'element-ui/lib/theme-chalk/index.css'
import './assets/css/base.css'
import './assets/css/icon.css'
import './assets/css/index.css'

import NProgress from 'nprogress'
import 'nprogress/nprogress.css'

Vue.component('tree-table', treeTable)

axios.defaults.baseURL = 'https://www.liulongbin.top:8888/api/private/v1/'
axios.interceptors.request.use(config => {
  NProgress.start();
  // 访问api需要在头文件中添加token
  config.headers.Authorization = window.sessionStorage.getItem('token')
  return config;
}, error => {
  // Do something with request error
  return Promise.reject(error);
});
axios.interceptors.response.use(config => {
  NProgress.done();
  return config
})


Vue.prototype.$http = axios





new Vue({
  router,
  render: h => h(App)
}).$mount('#app')